; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -loop-unroll -unroll-threshold=300  -S < %s | FileCheck %s

; This test caused a compile-time explosion in ValueTracking
; because we cloned the assume value and call greatly and
; then spent far too long analyzing those.

define void @PR49171(i32 %arg) {
; CHECK-LABEL: @PR49171(
; CHECK-NEXT:  entry:
; CHECK-NEXT:    br label [[LOOP:%.*]]
; CHECK:       loop:
; CHECK-NEXT:    [[ASSUME:%.*]] = icmp eq i32 0, [[ARG:%.*]]
; CHECK-NEXT:    call void @llvm.assume(i1 [[ASSUME]])
; CHECK-NEXT:    ret void
;
entry:
  br label %loop

loop:
  %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
  %iv2 = phi i32 [ 0, %entry ], [ %arg, %loop ]
  %assume = icmp eq i32 %iv2, %arg
  call void @llvm.assume(i1 %assume)
  %iv.inc = add nuw nsw i32 %iv, 1
  %exitcond = icmp eq i32 %iv.inc, 50 ; Increase me!
  br i1 %exitcond, label %exit, label %loop

exit:
  ret void
}

declare void @llvm.assume(i1)
